<?

require_once ("application.list.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;
global $_IFACE_CONTROL_OBJECT;
global $_SET_TABBING;

$fs_local_document = $_SERVER["PHP_SELF"];

$lc_ass_tra_assets = array (
	description=>array (label=>"Description",order=>"DEFAULT",wrapper=>"vmc_icon_asset"),
	status=>array (label=>"Status",alias=>"status",order=>"DEFAULT"),
	category=>array (label=>"Category",alias=>"category",order=>"DEFAULT"),
	model=>array (label=>"Model",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
	date_acquired=>array (label=>"Date Acquired",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
	current_value=>array (label=>"Current Value",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
);

$link_options_path = array (
	array (
		fs_tab=>"ass_tra_assets",
		fs_tab_option=>"lc_ass_tra_assets",
	)
);

$link_options = _app_create_tabbing (null, $link_options_path);

$object_ctl_path = array (
	array (
		fs_action=>"view",
		fs_tab=>"ass_tra_assets",
		fs_tab_option=>"fs_ass_tra_assets"
	)
);

$object_ctl = _app_create_tabbing ( "{$fs_local_document}?",
		$object_ctl_path) . "&";

$list_options_path = array (
	array (
		fs_tab=>"ass_tra_assets",
		fs_action=>"addnew",
		fs_tab_option=>"fs_ass_tra_assets"
	)
);
		
$list_options = array (
	array (
		label=>"Add An Asset",
		link=>_app_create_tabbing ("{$fs_local_document}?",$list_options_path)
	),
);

$_OBJECT_IFACE_LIST = _app_create_list_object (array (
                db_conn=>$_GLOBAL_DBH,
                indexes=>$lc_ass_tra_assets,
		list_count=>"SELECT COUNT(*) FROM ass_tra_assets",
		list_select=>"SELECT ass_tra_assets.*,ass_tra_categories.name AS category,ass_tra_status.id AS status FROM ass_tra_assets,ass_tra_status,ass_tra_categories WHERE category_id=ass_tra_categories.id AND status_id=ass_tra_status.id",
                list_id=>"lc_ass_tra_assets",
                list_options=>$list_options,
                primary_key=>"id",
                primary_relation=>"asset_id",
                link_options=>$link_options,
                object_ctl=>$object_ctl
));


if (($_REQUEST["fs_tab"] == "ass_tra_assets") &&
		($_REQUEST["fs_tab_option"] == "fs_ass_tra_assets") &&
		($_REQUEST["asset_id"] > 0))
	$_SET_TABBING = true;

array_push ($_IFACE_CONTROL_OBJECT, $_OBJECT_IFACE_LIST);

?>
